﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Anonym.Models.Common
{
    public class PageReturn<T>
    {
        /// <summary>
        ///  当前页码
        /// </summary>
        public int PageIndex { get; set; } = 1;
        /// <summary>
        /// 单页条数
        /// </summary>
        public int PageSize { get; set; } = 10;
        /// <summary>
        /// 总页数
        /// </summary>
        public int PageCount
        {
            get
            {
                var result = -1;
                try
                {
                    result = (int)Math.Ceiling(RecordCount / (double)PageSize);
                }
                catch (Exception)
                {
                }
                return result;
            }
        }
        /// <summary>
        /// 记录总数
        /// </summary>
        public int RecordCount { get; set; } = 0;

        /// <summary>
        /// 返回集合
        /// </summary>
        public List<T> List { get; set; } = new List<T>();

    }

    public class PageModel
    {
        /// <summary>
        ///  当前页码
        /// </summary>
        public int PageIndex { get; set; } = 1;
        /// <summary>
        /// 单页条数
        /// </summary>
        public int PageSize { get; set; } = 10;
        /// <summary>
        /// 总条数
        /// </summary>
        public long RecordCount { get; set; } = 0;
    }
}
